<!DOCTYPE html>
<!--[if IE 8 ]> <html lang="en" class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html lang="en" class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en"> <!--<![endif]-->
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>用户注册</title>


<!--[if lt IE 9]>
<script src="__STATIC__/register/js/html5shiv.js"></script>
<![endif]-->

<link href="__STATIC__/register/css/normalize.css" rel="stylesheet"/>
<link href="__STATIC__/register/css/jquery-ui.css" rel="stylesheet"/>
<link href="__STATIC__/register/css/jquery.idealforms.min.css" rel="stylesheet" media="screen"/>

<style type="text/css">
body{font:normal 15px/1.5 Arial, Helvetica, Free Sans, sans-serif;color: #222;background:url('__STATIC__/register/pattern.png');overflow-y:scroll;padding:60px 0 0 0;}
#my-form{width:755px;margin:0 auto;border:1px solid #ccc;padding:3em;border-radius:3px;box-shadow:0 0 2px rgba(0,0,0,.2);}
#comments{width:350px;height:100px;}
</style>

</head>
<body>


<div class="row">

  <div class="eightcol last">

    <!-- Begin Form -->

    <form id="my-form" action="">

        <section name="填写基本信息">

          <div><label>用户名:</label><input id="nickname" name="nickname" type="text" placeholder="请输入6个字符以上的用户名~"/></div>
          <div><label>密码:</label><input id="password" name="password" type="password" placeholder="请输入密码~"/></div>
          <div><label>确认密码:</label><input id="password_confirm" name="password_confirm" type="password" placeholder="请再次输入密码~" /></div>
         <!-- <div><label>出生日期:</label><input name="date" class="datepicker" data-ideal="date" type="text" placeholder="月/日/年"/></div>-->
         <!-- <div><label>上传头像:</label><input id="file" name="file" multiple type="file"/></div>-->
          <div><label>电话:</label><input name="phone" placeholder="请输入电话号码~" type="text"/></div>
        </section>

      <div><hr/></div>

      <div>
        <button  type="button" id="submit">提交</button>
        <button id="reset" type="button">重置</button>
      </div>

    </form>

    <!-- End Form -->

  </div>

</div>


<script type="text/javascript" src="__STATIC__/register/js/jquery-1.8.2.min.js"></script>
<script type="text/javascript" src="__STATIC__/register/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="__STATIC__/register/js/jquery.idealforms.js"></script>
<script type="text/javascript">
var options = {

/*	onFail: function(){
		/!*alert( $myform.getInvalid().length +' invalid fields.' )*!/
	},

	inputs: {
		'password': {
			filters: 'required password',
		},
		'username': {
			filters: 'required username',
			data: {
			//ajax: { url:'validate.php' }
			}
		},
		'file': {
			filters: 'extension',
			data: { extension: ['jpg'] }
		},
		'comments': {
			filters: 'min max',
			data: { min: 50, max: 200 }
		},
		'states': {
			filters: 'exclude',
			data: { exclude: ['default'] },
			errors : {
				exclude: '选择国籍.'
			}
		},
		'langs[]': {
			filters: 'min max',
			data: { min: 2, max: 3 },
			errors: {
				min: 'Check at least <strong>2</strong> options.',
				max: 'No more than <strong>3</strong> options allowed.'
			}
		}
	}*/
	
};
$('#reset').click(function(){
    $myform.reset().fresh().focusFirst()
});
var $myform = $('#my-form').idealforms(options).data('idealforms');

$(function() {
    $('#submit').click(function() {
        var d = {};
        var t = $('form').serializeArray();
        $.each(t, function() {
            d[this.name] = this.value;
        });
        var data = d;
        var url = '{:url("/user/register2")}';
        $.post(url,data,function(data){
            if(data.code==1){
                alert(data.msg);
                window.location.href = "{:url('user/login')}"
            }else{
                alert(data.msg);
            }
        },'json');
    });
});
</script>
<div style="text-align:center;">
</div>
</body>
</html>